/*************************************************
* Title：TinyToolKit
* Author：Opportunity 
* Describe：菜单按钮导出TinyToolKit包
* CreateTime：2020-04-05 18:49:44
* Version：1.0
* Modify Recorder：
*************************************************/
using UnityEngine;
using UnityEditor;
using System.IO;

namespace TinyToolKit.Editor
{
    public class ExportHelper : MonoBehaviour
    {
        public static void Export()
        {
            string filePath = Application.dataPath + "/../" + "TinyToolKit";
            if (Directory.Exists(filePath) == false)
                Directory.CreateDirectory(filePath);

            string assetPathName = "Assets/TinyToolKit";
            string data = System.DateTime.Now.ToString("yyyy-MMdd-HHmm");
            string fileName = string.Format("TinyToolKit/TinyToolKit_{0}.unitypackage", data);
            AssetDatabase.ExportPackage(assetPathName, fileName, ExportPackageOptions.Recurse);
            Application.OpenURL("file://" + filePath);
        }
    }
}
